#pragma once
#include <string>
#include <iostream>

using namespace std;

class Student
{

private:
	// karakteristisk data
	string sFirstName;
	string sSecondName;
	int iEnrollmentYear;

public:
	//konstruktorer
	Student(void)
	{
		sFirstName = " ";
		sSecondName = " ";
		iEnrollmentYear = 0;
	}

	Student(string firstName, string secondName, int enrollmentYear)
	{
		sFirstName = firstName;
		sSecondName = secondName;
		iEnrollmentYear = enrollmentYear;
	}
	// destruktor
	~Student(void);

	//get-set-metoder
	string GetFirstName() {return sFirstName;}
	void SetFirstName(string name) {sFirstName = name;}
	string GetSecondName() {return sSecondName;}
	void SetSecondName(string name) {sSecondName = name;}
	int GetEnrollmentYear() {return iEnrollmentYear;}
	void SetEnrollmentYear(int year) {iEnrollmentYear = year;}

	//medlemsfunktioner
	void Read()
	{
		cout << "Please provide information on a student." << endl;
		cout << "First name: ";
		cin >> sFirstName;
		cout << "Second name: ";
		cin >> sSecondName;
		cout << "Year of enrollment: ";
		cin >> iEnrollmentYear;
		cout << endl;

	}
	void Write()
	{
		cout << "Student: " << sFirstName << " " << sSecondName << endl;
		cout << "Enrolled in: " << iEnrollmentYear << endl << endl;
	}

	friend ostream& operator<< (ostream& o, const Student& student)
	{
		o << student.sFirstName << " " << student.sSecondName << "," << student.iEnrollmentYear << endl;
		return o;
	}

	friend istream& operator>> (istream& i, Student& student)
	{
		string s;
		getline(i, student.sFirstName, ' ');
		getline(i, student.sSecondName, ',');
		i >> student.iEnrollmentYear;

		return i;
	}
};

